﻿@using SmartStore.Web.Models.Catalog;
@using SmartStore.Core.Domain.Catalog;
@model IListActions

<!-- Filter -->
@if (Model.AllowFiltering)
{
	<div class="artlist-action artlist-action--filter d-lg-none">
		<div class="mf-dropdown">
			<button class="btn btn-warning btn-labeled icon-right btn-no-border btn-block btn-toggle-filter-widget">
				<span>@T("Products.ToFilter")</span>
				<b><i class="fa fa-fw fa-sliders-h"></i></b>
			</button>
		</div>
	</div>
}

<!-- Sort -->
@if (Model.AllowSorting)
{
	<div class="artlist-action artlist-action--sort">
		<div class="mf-dropdown">
			<button class="btn btn-secondary btn-artlist-action d-none d-lg-block" title="@T("Products.SortByX", Model.CurrentSortOrderName)">
				<i class="fa fa-sort d-xl-none"></i>
				<span class="d-xl-none">@Model.CurrentSortOrderName</span>
				<em class="d-none d-xl-inline">@T("Products.SortByX", "<span>" + Model.CurrentSortOrderName + "</span>")</em>
				<i class="fas fa-caret-down"></i>
			</button>
			<button class="btn btn-light btn-no-border btn-labeled icon-right btn-block d-lg-none">
				<span>@T("Products.ToSort")</span>
				<b><i class="fa fa-fw fa-sort"></i></b>
			</button>
			<select class="artlist-action-select form-control noskin" name="artlist-action-sort" id="artlist-action-sort" data-qname="o" title="@T("Products.SortByX", Model.CurrentSortOrderName)">
				@foreach (var sort in Model.AvailableSortOptions)
				{
					var sortName = (Model is ProductSummaryModel && sort.Key == (int)ProductSortingEnum.Relevance) ? Model.RelevanceSortOrderName : null;
					<option value="@sort.Key" @Html.Attr("selected", "selected", sort.Key == Model.CurrentSortOrder)>@(sortName ?? sort.Value)</option>
				}
			</select>
		</div>
	</div>
}